<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Iemvn.com - Liên đoàn truyền giáo Phúc Âm</title>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/backend/css/login.css" media="screen">
        <!-- These stylesheets are used  -->
        <!--[if IE 6]><link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/backend/css/ie6.css" media="screen" /><![endif]-->
        <!--[if IE 7]><link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/backend/css/ie.css" media="screen" /><![endif]-->
        <style type="text/css">
            p.error{
                color: #c00;
                font-size: 11px;
                margin: 30px 30px 10px;
            }
        </style>
    </head>
    <body>
        <form id="loginForm" name="loginForm" action="" method="post">
            <div id="login_box" class="round_all clearfix">
                <label class="fields">
                    <strong>Email</strong>
                    <input type="text" id="email" name="email" class="indent round_all">
                </label>
                <label class="fields">
                    <strong>Password</strong>
                    <input type="password" id="password" name="password" class="indent round_all">
                </label>
                <button class="button_colour round_all" onClick="return checkValid()">
                    <img width="24" height="24" alt="Login" src="<?php echo base_url(); ?>static/backend/images/icons/small/white/Locked%202.png">
                    <span>Login</span>
                </button>
                <div id="bar" class="round_bottom">
                    <label><input type="checkbox" name="remember" value="1">Remember me!</label>
                    <a href="#">Forgot your password?</a>
                </div>
                <p id="error_msg" class="error"><?php echo $this->session->flashdata('error_message'); ?></p>
                <a href="<?php echo base_url(); ?>" id="login_logo">
                    <span>Backend Iemvn.com</span>
                </a>
            </div>
        </form>
        <script type="text/javascript">
            function checkValid()
            {
                var email = document.getElementById('email').value;
                var password = document.getElementById('password').value;
                
                if(email == '' || password == '' || !checkEmail(email)){
                    document.getElementById('error_msg').innerHTML = 'Email không đúng định dạng.';
                    return false;
                }else{
                    document.loginForm.submit();
                }
            }
            
            function checkEmail(email) 
            {
                var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                if (!filter.test(email)) {
                    return false;
                }
                return true;
            }
        </script>
    </body>
</html>